﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="DeleteLocations.aspx.cs" Inherits="cs499.Locations.DeleteLocations" %>
<%@ MasterType VirtualPath="~/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content runat="server" ID="navbar" ContentPlaceHolderID="NavOptions">
    <asp:Button ID="CancelButton" runat="server" OnClick="CancelButton_Click" Text="Cancel" Width="133px" />
</asp:Content>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        <div class="content-wrapper">
            <h3>List of Locations For <asp:Label ID="DepartmentLabel" runat="server" Text="" /></h3>
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    
    <asp:GridView ID="GridView1" runat="server" OnRowDeleted="GridView1_RowDeleted" AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="EntityDataSourceBuildings" AllowSorting="True" OnRowDeleting="GridView1_RowDeleting">
        <Columns>
            <asp:CommandField ShowDeleteButton="True"  />
            <asp:BoundField DataField="Code" HeaderText="Code" SortExpression="Code" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSourceBuildings" runat="server" ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EntitySetName="Places" EntityTypeFilter="Building" Where="it.Department.Id=@newparameter" EnableDelete="True">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" DefaultValue="-1" Name="newparameter" SessionField="CurrentDepartmentId" />
        </WhereParameters>
    </asp:EntityDataSource>
    
    <asp:GridView ID="GridView2" runat="server" DataSourceID="EntityDataSourceRooms" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="Id" OnRowDeleting="GridView2_RowDeleting" OnRowDeleted="GridView2_RowDeleted">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" />
            <asp:TemplateField HeaderText="Building Name" SortExpression="Building.Name" ItemStyle-Width="100px">
                <ItemTemplate>
                  <asp:Label ID="Label1" runat="server" Text='<%# Eval("Building.Name") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="100px"></ItemStyle>
            </asp:TemplateField>
            <asp:BoundField DataField="Number" HeaderText="Number" SortExpression="Number" ItemStyle-Width="50px" >
            <ItemStyle Width="50px"></ItemStyle>
            </asp:BoundField>
            <asp:BoundField DataField="Capacity" HeaderText="Capacity" SortExpression="Capacity" />
        </Columns>
    </asp:GridView>
    <asp:EntityDataSource ID="EntityDataSourceRooms" runat="server"  ConnectionString="name=Model1Container" DefaultContainerName="Model1Container" EntitySetName="Places" EntityTypeFilter="Room" Where="it.Department.Id=@newparameter" Include="Building, DependentCourses" EnableDelete="True">
        <WhereParameters>
            <asp:SessionParameter DbType="Int32" DefaultValue="-1" Name="newparameter" SessionField="CurrentDepartmentId" />
        </WhereParameters>
    </asp:EntityDataSource>
    
</asp:Content>
